# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# service = webdriver.ChromeService('E:\chromedriver-win64\chromedriver.exe')
# driver = webdriver.Chrome(service=service)
# driver.maximize_window()
# driver.get("https://demoqa.com/text-box")
#
# full_name = driver.find_element(By.CSS_SELECTOR, "#userName")
# full_name.send_keys("qiku")
#
# username = driver.find_element(By.XPATH, '//input[@id="userEmail"]')
# username.send_keys("奇酷")
#
#
# driver.implicitly_wait(10)
# driver.quit()
# import time
#
# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# service = webdriver.ChromeService("E:\chromedriver-win64\chromedriver.exe")
# driver = webdriver.Chrome(service=service)
# driver.maximize_window()
# driver.get("https://demoqa.com/webtables")
#
# searchValue = driver.find_element(By.ID, "searchBox")
# searchValue.send_keys("Vega")
# #
# # username = driver.find_element(By.XPATH, '//input[@id="userEmail"]')
# # username.send_keys("奇酷")
#
#
# addNewRecordButton = driver.find_element(By.ID, "addNewRecordButton")
# print(searchValue.text)
# print(searchValue.get_attribute("class"))
#
# driver.implicitly_wait(10)
# driver.quit()



import time
# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# service = webdriver.ChromeService('E:\chromedriver-win64\chromedriver.exe')
# driver = webdriver.Chrome(service=service)
# driver.maximize_window()
# driver.get("https://demoqa.com/alerts")
#
# alertButton = driver.find_element(By.ID, "alertButton")
# alertButton.click()
#
#
# driver.switch_to.alert.accept()
#
#
# timerAlertButton = driver.find_element(By.ID, "timerAlertButton")
# timerAlertButton.click()
#
#
# driver.switch_to.alert.accept()
#
# # driver.implicitly_wait(10)
# time.sleep(5)
# driver.quit()


# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# service = webdriver.ChromeService("E:\chromedriver-win64\chromedriver.exe")
# driver = webdriver.Chrome(service=service)
# driver.maximize_window()
# # driver.get("https://demoqa.com/alerts")
#
# time.sleep(2)
# driver.execute_script("window.open()")
# # print(driver.window_handles)
# driver.switch_to.window(driver.window_handles[1])
# time.sleep(2)
# driver.close()
# time.sleep(2)
#
#
#
# print(driver.window_handles)
# driver.switch_to.window(driver.window_handles[0])
#
# driver.execute_script("window.open()")
#
# print(driver.window_handles)
#
#
#
#
# # driver.implicitly_wait(10)
# time.sleep(5)
# driver.quit()




# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# service = webdriver.ChromeService('E:\chromedriver-win64\chromedriver.exe')
# driver = webdriver.Chrome(service=service)
# driver.maximize_window()
# driver.get("https://gitee.com/null_435_7166/python2507spiders/blob/master/52.selenium%20%E5%9F%BA%E7%A1%80.py")
#
# time.sleep(2)
#
# driver.execute_script("document.documentElement.scrollTop = document.documentElement.scrollHeight")
#
# # driver.implicitly_wait(10)
# time.sleep(5)
# driver.quit()







# from selenium import webdriver
# from selenium.webdriver.common.by import By
#
# service = webdriver.ChromeService('E:\chromedriver-win64\chromedriver.exe')
# driver = webdriver.Chrome(service=service)
# driver.implicitly_wait(10)
#
#
# driver.maximize_window()
# driver.get('https://seleniumbase.io/demo_page/')
#
# # print(driver.page_source)
#
#
# iframe = driver.find_element(By.ID, 'myFrame2')
# print(iframe.location)
#
# # 切换进入iframe
# driver.switch_to.frame(iframe)
#
#
# h4 = driver.find_element(By.TAG_NAME, 'h4')
# print(h4, h4.text)
#
#
# time.sleep(5)
# driver.quit()











# from selenium import webdriver
# from selenium.webdriver import ActionChains
# from selenium.webdriver.common.by import By
#
# service = webdriver.ChromeService('E:\chromedriver-win64\chromedriver.exe')
# driver = webdriver.Chrome(service=service)
# driver.implicitly_wait(10)
#
#
# driver.maximize_window()
# driver.get('https://seleniumbase.io/demo_page/')
#
# # print(driver.page_source)
#
# driver.execute_script("""
# // 创建并注入样式
# const style = document.createElement('style');
# style.textContent = `
#   .mouse-tracker-dot {
#     position: fixed;
#     width: 10px;
#     height: 10px;
#     background-color: red;
#     border-radius: 50%;
#     pointer-events: none;
#     z-index: 9999;
#     transform: translate(-50%, -50%);
#     box-shadow: 0 0 5px rgba(0,0,0,0.5);
#   }
#
#   .mouse-tracker-coords {
#     position: fixed;
#     top: 10px;
#     left: 10px;
#     background: rgba(0,0,0,0.8);
#     color: white;
#     padding: 5px 10px;
#     border-radius: 3px;
#     font-family: Arial, sans-serif;
#     font-size: 12px;
#     z-index: 10000;
#     pointer-events: none;
#   }
# `;
# document.head.appendChild(style);
#
# // 创建鼠标跟踪点
# const mouseDot = document.createElement('div');
# mouseDot.className = 'mouse-tracker-dot';
# document.body.appendChild(mouseDot);
#
# // 创建坐标显示
# const coordsDisplay = document.createElement('div');
# coordsDisplay.className = 'mouse-tracker-coords';
# coordsDisplay.textContent = 'X: 0, Y: 0';
# document.body.appendChild(coordsDisplay);
#
# // 确保body有最小高度
# document.body.style.minHeight = '100vh';
#
# // 鼠标移动事件监听
# document.addEventListener('mousemove', (e) => {
#   // 更新红点位置
#   mouseDot.style.left = e.clientX + 'px';
#   mouseDot.style.top = e.clientY + 'px';
#
#   // 更新坐标显示
#   coordsDisplay.textContent = `X: ${e.clientX}, Y: ${e.clientY}`;
# });
#
# // 鼠标离开窗口时隐藏红点
# document.addEventListener('mouseleave', () => {
#   mouseDot.style.display = 'none';
#   coordsDisplay.textContent = '鼠标离开窗口';
# });
#
# // 鼠标进入窗口时显示红点
# document.addEventListener('mouseenter', () => {
#   mouseDot.style.display = 'block';
# });
#
# // 页面加载完成后初始化
# window.addEventListener('load', () => {
#   console.log('鼠标位置跟踪已启动 - 红色圆点显示当前位置');
# });
#
# // 防止与其他脚本冲突
# (function() {
#   // 检查是否已经存在鼠标跟踪
#   if (window.mouseTrackerInitialized) {
#     console.warn('鼠标跟踪已经初始化');
#     return;
#   }
#   window.mouseTrackerInitialized = true;
# })();
# """)
#
# myButton = driver.find_element(By.ID, 'myButton')
#
# mySlider = driver.find_element(By.ID, 'mySlider')
# print(mySlider.location, mySlider.size, mySlider.rect)
#
#
# # 构建动作练实例
# ac = ActionChains(driver)
# # 移动到元素
# # ac.move_to_element(mySlider)
# # offsetx = mySlider.size['width'] * 40 / 100
# # ac.drag_and_drop_by_offset(mySlider, offsetx, 0)
#
# # ac.click(myButton)
#
# # ac.move_to_element(myButton)
# # ac.click()
#
# # offsetx = mySlider.size['width'] * 100 / 100
# # ac.move_to_element_with_offset(mySlider, mySlider.size['width'] * (-40) / 100, 0).click_and_hold().move_by_offset(offsetx, 0).release()
# # ac.move_to_element(mySlider).click_and_hold().move_by_offset(offsetx, 0).release()
#
# # 执行动作练
# ac.perform()
#
# ac.release()
#
#
#
# time.sleep(50)
# driver.quit()





from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By

service = webdriver.ChromeService('E:\chromedriver-win64\chromedriver.exe')
driver = webdriver.Chrome(service=service)
driver.implicitly_wait(10)

driver.maximize_window()
driver.get('https://seleniumbase.io/demo_page/')

# print(driver.page_source)


myDropdown = driver.find_element(By.ID, 'myDropdown')
myDropdown.screenshot("./static/myDropdown.png")

time.sleep(50)
driver.quit()



